{% extends 'common/base.html'%}

{% block title%}新闻详情页{% endblock%}

{% block head%}
	<link rel="stylesheet" href="{% static 'css/news_detail.min.css'%}">
{% endblock%}

{% block main%}
	<div class="main">
		<div class="wrapper">
			<div class='main-content-wrapper'>
				<div class="news-wrapper">
					<h1 class="title">{{new.title}}</h1>
					<div class="news-info">
						<div class="info-group">
							<span class="author">{{new.author.username}}
							</span>
							<span class="pub-time">{{new.pub_time}}</span>
							<span class="category">{{new.category.name}}</span>
						</div>
					</div>	
				</div>
				<article class="article">
					{{new.content}}
				</article>
				<div class="comment-wrapper">
					<form action="" method="post">
						{% csrf_token %}
						{% if user.is_authenticated %}
							<h3 class="title">文章评论({{number}})</h3>
							<textarea name="comment" class="comment-textarea"  placeholder="在此输入参与评论" rows="7">
							</textarea>
						<div class="submit-btn-group">
						<button class="submit-btn">立即评论</button>
						</div>
					</form>
						{% else %}
							<h3 class="title">文章评论({{number}})</h3>
							<p>登陆后方可进行评论！</p>
						<div class="submit-btn-group">
						<button class="submit-btn">立即评论</button>
						</div>
					</form>
					{% endif %}
					<ul class="comment-list">
						{% for comment in comments %}
							<li>
								<div class="comment-info">
									<img src="https://static-image.xfz.cn/1526030386_640.png" alt="" class="avatar">
									<div class="avatar-info">
										<span class="author">{{comment.author.username}}</span>
										<span class="pub-time">{{comment.pub_time}}</span>
									</div>
									<span class="comment-content">{{comment.comment}}</span>
								</div>
							</li>
						{% endfor %}
					</ul>
				</div>
			</div>

			{%include 'common/sidebar.html'%}
		</div>
	</div>
{% endblock%}